package com.enjoyor.health.HGPT.web;

import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import org.omg.CORBA.PUBLIC_MEMBER;

/**
 * 返回信息包装类
 * @author Zhu Min
 * @date 2023/10/18 9:32
 */
@Data
public class RetResult {

    public RetResult() {
        this.result = new JSONObject();
        this.statusCode = CodeEnum.SUCCESS.getStatusCode();
        this.message    = CodeEnum.SUCCESS.getMessage();
    }

    public RetResult(CodeEnum codeEnum){
        this.statusCode = codeEnum.getStatusCode();
        this.message = codeEnum.getMessage();
        this.result = new JSONObject();
    }

    public RetResult(Integer statusCode, String message) {
        this.statusCode = statusCode;
        this.message = message;
    }

    private Integer statusCode;

    private String message;

    private Object result;

    public RetResult of(CodeEnum codeEnum){
        this.statusCode = codeEnum.getStatusCode();
        this.message = codeEnum.getMessage();
        return this;
    }

    public RetResult setResult(Object result) {
        this.result = result;
        return this;
    }
}
